package org.i1510.common.utils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.i1510.common.bean.SessionUserBean;

/**
 * @author Administrator
 * 用户工具
 */
public class UserUtils {
	/**
	 * 匿名用户
	 */
	private static SessionUserBean anonymousUser;
	public static SessionUserBean getSessionUserBean(HttpServletRequest request) {
		HttpSession session = request.getSession();
		Object userSession = session.getAttribute("userSession");
		if(null != userSession){
			SessionUserBean rtnVal = (SessionUserBean) userSession;
			return rtnVal;
		}else{
			return new  SessionUserBean(KBProperties.ANONYMOUSUSER_DOCID,KBProperties.ANONYMOUSUSER_NAME,KBProperties.ANONYMOUSUSER_NICKNAME);
		}
		
	}
	/**
	*@Author Rambo
	*@Desc：会话用户信息
	*@return TODO
	*@Version  UserUtils.java,v 1.1 2013-11-15 下午4:09:54 
	*/
	public static SessionUserBean getSessionUserBean() {
		SessionUserBean rtnVal = new SessionUserBean();
		if (rtnVal == null){
			return new  SessionUserBean(KBProperties.ANONYMOUSUSER_DOCID,KBProperties.ANONYMOUSUSER_NAME,KBProperties.ANONYMOUSUSER_NICKNAME);
		}else{
			return rtnVal;
		}		
		
	}
}
